home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
10,000 Great Games
/
10,000 Great Games.iso
/
Product
/
66
/
data1.cab
/
Source_Files
/
Src
/
TIMER.H
< prev
next >
Wrap
C/C++ Source or Header
|
2000-01-16
|
665b
|
40 lines
// Time
class cTimer
{
public:
cTimer() { t = get(); }
operator int() { return get() < t; }
void operator = (int dt) { t = get() + dt; }
int raw_delta() { int tt = get(), d = tt - t; t = tt; return d; }
fix delta() { return (fix)raw_delta() / sec; }
void wait() { while (get() < t); }
static void pause();
static void unpause();
static void togglepause();
static int is_paused() { return paused; }
static int get()
{
int t = timeGetTime();
if (!paused)
timer += t - last;
last = t;
return timer >> 4;
}
private:
int t;
static int timer, last, paused;
};